import { PAGE_SIZE_BASE } from '@/constants/common';
import Xhr from './axios/xhr';

const saveBlock = block => Xhr.post('/block', block);
const getBlockById = id => Xhr.get(`/block/${id}`);
const updateBlockById = (id, block) => Xhr.put(`/block/${id}`, block);
const getBlockList = (index = 1, size = PAGE_SIZE_BASE, keyword = '')  => Xhr.get(`/block/list?pageSize=${size}&pageIndex=${index}&keyword=${keyword}`);
const deleteBlockById = id => Xhr.delete(`/block/${id}`);

export {
  saveBlock,
  getBlockById,
  updateBlockById,
  getBlockList,
  deleteBlockById,
};
